<template>
    <div style="display: flex;line-height: 60px;">
        <div style="flex: 1;text-align: center;font-size: 30px;" >
            <span>学习营地活动管理平台</span>
        </div>
            <el-dropdown>
                <span>{{user.data.loginName}}</span>
                <i class="el-icon-arrow-down" style="margin-left: 15px"></i>
                <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item @click.native="logout">退出登录</el-dropdown-item>

                </el-dropdown-menu>
            </el-dropdown>

    </div>

</template>

<script>
export default {
    name: "HeaderPage",
    data(){
        return{
            user:JSON.parse(sessionStorage.getItem('CurUser')),
        }
    },
    methods:{
        toUser(){

        },
        logout(){

            this.$confirm('确定要退出登录吗？','提示',{
                confirmButtonText:'确定',
                type:'warning',
                center:true,
            })

                .then(()=>{
                    this.$message({
                        type:'success',
                        message:'退出登录成功',
                    })
                    this.$router.push("/");
                    sessionStorage.clear();
                })
                .catch(()=>{
                    this.$message({
                        type:'info',
                        message:'取消',
                    })
                })


        }
    },
}
</script>

<style scoped>

</style>